package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Electpres {
    private int electpresId;
    private String electpresPersonnel;
    private Date electpresDate;
    private Collection<Diagdetails> diagdetailsByElectpresId;
    private Operaproject operaprojectByOperaprojectId;
    private Diagdoctor diagdoctorByDiagdoctorId;
    private Hospinfo hospinfoByHospinfoId;

    @Id
    @Column(name = "electpres_id", nullable = false)
    public int getElectpresId() {
        return electpresId;
    }

    public void setElectpresId(int electpresId) {
        this.electpresId = electpresId;
    }

    @Basic
    @Column(name = "electpres_personnel", nullable = true, length = 30)
    public String getElectpresPersonnel() {
        return electpresPersonnel;
    }

    public void setElectpresPersonnel(String electpresPersonnel) {
        this.electpresPersonnel = electpresPersonnel;
    }

    @Basic
    @Column(name = "electpres_date", nullable = true)
    public Date getElectpresDate() {
        return electpresDate;
    }

    public void setElectpresDate(Date electpresDate) {
        this.electpresDate = electpresDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Electpres electpres = (Electpres) o;
        return electpresId == electpres.electpresId &&
                Objects.equals(electpresPersonnel, electpres.electpresPersonnel) &&
                Objects.equals(electpresDate, electpres.electpresDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(electpresId, electpresPersonnel, electpresDate);
    }

    @OneToMany(mappedBy = "electpresByElectpresId")
    public Collection<Diagdetails> getDiagdetailsByElectpresId() {
        return diagdetailsByElectpresId;
    }

    public void setDiagdetailsByElectpresId(Collection<Diagdetails> diagdetailsByElectpresId) {
        this.diagdetailsByElectpresId = diagdetailsByElectpresId;
    }

    @ManyToOne
    @JoinColumn(name = "operaproject_id", referencedColumnName = "operaproject_id")
    public Operaproject getOperaprojectByOperaprojectId() {
        return operaprojectByOperaprojectId;
    }

    public void setOperaprojectByOperaprojectId(Operaproject operaprojectByOperaprojectId) {
        this.operaprojectByOperaprojectId = operaprojectByOperaprojectId;
    }

    @ManyToOne
    @JoinColumn(name = "diagdoctor_id", referencedColumnName = "diagdoctor_id")
    public Diagdoctor getDiagdoctorByDiagdoctorId() {
        return diagdoctorByDiagdoctorId;
    }

    public void setDiagdoctorByDiagdoctorId(Diagdoctor diagdoctorByDiagdoctorId) {
        this.diagdoctorByDiagdoctorId = diagdoctorByDiagdoctorId;
    }

    @ManyToOne
    @JoinColumn(name = "hospinfo_id", referencedColumnName = "hospinfo_id")
    public Hospinfo getHospinfoByHospinfoId() {
        return hospinfoByHospinfoId;
    }

    public void setHospinfoByHospinfoId(Hospinfo hospinfoByHospinfoId) {
        this.hospinfoByHospinfoId = hospinfoByHospinfoId;
    }
}
